<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="/js/jquery-2.1.4.js"></script>
    <script>
        $(function () {
            $("#login").on('click',function () {
                $.post('/login',{
                    "username":$("#username").val(),
                    "password":$("#password").val()
                },function (result) {
                    console.log(result)
                    if(result==1){
                        alert("登录成功")
                    }else if (result==-999){
                        alert('密码错误');
                    }else{
                        alert('该用户不存在')
                    }
                })
            })
        })
    </script>
</head>
<body>
<p>用户：<input type="text" id="username"></p>
<p>密码：<input type="password" id="password"></p>
<p><input type="button" id="login" value="登录"></p>
</body>
</html>